package com.xinxin.leetcode.problem401;

import java.util.ArrayList;
import java.util.List;

/**
 * @author ShiXinXin
 * @date 2019-12-15 20:09
 */
public class Solution {
    private int count(int n) {
        int res = 0;
        while (n != 0) {
            n = n & (n - 1);
            res++;
        }
        return res;
    }

    public List<String> readBinaryWatch(int num) {
        List<String> list = new ArrayList<>();
        for (int i = 0; i < 12; i++) {
            for (int j = 0; j < 60; j++) {
                if (count(i) + count(j) == num) {
                    list.add(i + ":" + (j < 10 ? "0" + j : j));
                }
            }
        }
        return list;
    }

    public static void main(String[] args) {
        System.out.println(new Solution().readBinaryWatch(1));
    }
}
